package com.mars.beans;

import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.Min;

/**
 * 分页
 * @author MARS
 * @date 2018/1/12
 */
public class PageQuery {

    @Getter
    @Setter
    @Min(value = 1,message = "当前页码不合法")
    private int pageNo = 1;

    @Getter
    @Setter
    @Min(value = 1,message = "每页展示数量不合法")
    private int pageSize = 10;

    /**
     * 偏移量
     */

    private int offset ;

    public void setOffset(int offset) {
        this.offset = offset;
    }

    public int getOffset() {
        offset = (pageNo - 1) * pageSize;
        return offset;
    }

}
